package org.mm.xml;

import javax.xml.bind.annotation.XmlAttribute;

import org.mm.parameter.enm.Error;
import org.mm.xml.entities.ErrorXML;

/**
 * ResponseXML
 *
 * @author Marco Traversari
 * @version $Revision: $ $Date: $ $Author: $
 */
public abstract class ResponseXML {

	private String type = null;


	private ErrorXML error = null;


	/**
	 * getType
	 * @return type
	 */
	@XmlAttribute
	public String getType() {
		return type;
	}

	/**
	 * setType
	 * @param type
	 */
	public void setType(String typeId) {
		this.type = typeId;
	}

	/**
	 * getError
	 * @return error
	 */
	public ErrorXML getError() {
		return error;
	}

	/**
	 * setError
	 * @param error
	 */
	public void setError(ErrorXML error) {
		clear();
		this.error = error;
	}
	
	/**
	 * setError
	 * @param error
	 */
	public void setError(Error error) {
		ErrorXML errorXML = new ErrorXML(error.code, error.message);
		setError(errorXML);
	}

	public abstract void clear();

}
